package org.huangke.pojo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Component("student")
public class Student {
    @Value("1")
    private String id;
    @Value("张三")
    private String name; 	// 省略getter/setter方法，以及toString()方法

    @PostConstruct
    public void init(){
        System.out.println("Bean的初始化完成，调用init()方法");
    }

    @PreDestroy
    public void destroy() {
        System.out.println("Bean销毁前调用destroy()方法");

    }

}
